package server;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;


public class Server {
    //定义一个集合记住所有在线的客户端
     public static final Map<Socket, String> onLineSockets = new HashMap<>();
    public static void main(String[] args) {
        System.out.println("服务端启动成功");
        try {
            ServerSocket serverSocket = new ServerSocket(Constant.PORT);
            while (true) {
                System.out.println("等待客户端连接");
                Socket socket = serverSocket.accept();
                new ClientReaderThread(socket,null).start();
                System.out.println("客户端连接成功");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
